/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Calendar;

/**
 * <p>Project: javase - If3
 * <p>Powered by webrx On 2021-11-25 09:09:48
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class If3 {
    public static void main(String[] args) {
        var c = Calendar.getInstance();
        var h = c.get(Calendar.HOUR_OF_DAY);
        //01 if语句
        if (h < 12) {
            System.out.println("上午");
        } else {
            System.out.println("下午");
        }

        //02 格式化输出实现
        System.out.printf("%tp%n", c);

        //03 三元运算表达式
        System.out.println(h < 12 ? "上午" : "下午");
    }
}
